<template>
	<div class="goods_two">
		<div class="goods"
			id="goods"
		>
			<ul class="goods-items">
				<li class="goods-item"
					v-for="(goods, index) in goodsList"
					@click="goDetail(goods)"
				>
					<div class="goods-item-img">
						<img v-lazy="goods.itempic + '_310x310.jpg'" 
							:key="goods.itempic"
						/>
					</div>
					<p class="title one-line"><span class="TBimg" v-if="proType == '2'"></span><span class="TMimg" v-if=" proType == '1'"></span>{{goods.itemshorttitle}}</p>
					<div class="sale">
						<p class="oldprice">原价￥<span>{{goods.itemprice}}</span></p>
						<p>{{goods.itemsale}}人已买</p>
					</div>
					<div class="price">
						<i class="icon" :style="{backgroundImage: 'linear-gradient(to right, rgb(79, 92, 104), rgb(42, 62, 69))',background: 'linear-gradient(to right,' + colorLeft + ',' + colorRight + ')'}">券后价</i>
						<p class="coupon-price">￥<span>{{goods.coupon_price}}</span></p>
						<div class="gr-price-right" :style="{backgroundImage: 'linear-gradient(to right, rgb(79, 92, 104), rgb(42, 62, 69))',background: 'linear-gradient(to right,' + colorLeft + ',' + colorRight + ')'}">
							{{goods.couponmoney}}元券
							<div class="dotl"></div>
							<div class="dotr"></div>
						</div>
					</div>
				</li>
			</ul>
			<div class="goods-none"
				v-if="this.goodsList.length == 0"
			>
				<img src="../assets/img/nodata.png" />
			</div>
		</div>
	</div>
</template>
<script>
	import { Toast } from 'mint-ui'
	import axios from 'axios'
	import Http from '../http.js'
	export default{
		props: {
			goodsList: {
				type: Array
			},
			proType: {
				type: Number
			}
		},
		data(){
			return{
				colorLeft: window.localStorage.getItem("left"), 
				colorRight: window.localStorage.getItem("right"), 
				colorMid: window.localStorage.getItem("mid"), 
				token: window.localStorage.getItem("token"),
			}
		},
		mounted(){

		},
		methods: {
			goDetail: function(goods){
				var self = this;
				if ( goods.shoptype == 0 ) {
					self.type = 1
				} else {
					self.type = 2
				}
				self.$router.push({
					path: '/product/detail/' + goods.itemid,
					query: {
						type: self.type,
                        is_collect: goods.is_collect,
                        title: goods.itemtitle,
                        coupon_price: goods.coupon_price,
                        origin_price: goods.itemprice,
                        quan_price: goods.couponmoney,
                        sub_title: goods.itemshorttitle,
                        image: goods.itempic,
					}
				})
			},
		}
	}
</script>
<style lang="scss" scoped>
	.goods_two{
		@import '../assets/common/goods_two.scss'
	}
</style>